import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn } from 'typeorm'

import { User } from './user.entity'

/**
 * @description 身份证实体
 * 命令不要使用驼峰
 */
@Entity({ name: 'id_card' })
export class IdCard {
    //自增列
    @PrimaryGeneratedColumn()
    id: number
    //普通列
    @Column()
    cardName: string

    //普通列
    @Column()
    cardId: string

    @OneToOne(() => User, user => user.idCard)
    @JoinColumn({ name: 'user_id' })
    user: User
}